﻿using System;
class PrintNumsHard
{
    static void Main()
    {
        int number;
        Console.Write("Please input number: ");
        while (true)
        {
            try
            {
                number = int.Parse(Console.ReadLine());
                break;
            }
            catch (Exception)
            {
                Console.Write("This is not a number. Please re-enter: ");
            }
        }
        for (int i = 0; i <= number; i++)
        {
            if (((i % 3) != 0) && ((i % 7) != 0))
            {
                Console.Write("{0}, ", i);
            }
            else
            {
                continue;
            }
        }
        Console.ReadLine();
    }
}

